package com.gz.spring.component;

import org.junit.jupiter.api.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class AopTest {

    @Test
    public void test01(){
        ApplicationContext ioc =
                new ClassPathXmlApplicationContext("beans01.xml");
        UserService userService = ioc.getBean("userService", UserService.class);
        userService.m1();

        //@Scope(value = "prototype") 实现多例
        UserAction userAction1 = ioc.getBean("userAction", UserAction.class);
        UserAction userAction2 = ioc.getBean("userAction", UserAction.class);
        System.out.println(userAction1); //@87a85e1
        System.out.println(userAction2); //@671a5887
    }
}
